package com.chenxiao.builder;

import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;

/**
 * @Author: CX
 * @Date: Created in  2023/02/19 18:25
 * @version: v1.0
 * @Description: TODO
 **/
public class DecorationPackageMenu implements IMenu{

    // 装修清单
    private List<Matter> list = new ArrayList<>();
    // 装修价格
    private BigDecimal price = BigDecimal.ZERO;
    // 面积
    private BigDecimal area;
    // 装修风格
    private String grade;

    public DecorationPackageMenu(Double area, String grade) {
        this.area = new BigDecimal(area);
        this.grade = grade;
    }

    @Override
    public IMenu appendCeiling(Matter matter) {
        list.add(matter);
        price = price.add(area.multiply(new BigDecimal("0.2")).multiply(matter.price()));
        return this;
    }

    @Override
    public IMenu appendCoat(Matter matter) {
        list.add(matter);
        price = price.add(area.multiply(new BigDecimal("1.4")).multiply(matter.price()));
        return this;
    }

    @Override
    public IMenu appendFloor(Matter matter) {
        list.add(matter);
        price = price.add(area.multiply(matter.price()));
        return this;
    }

    @Override
    public IMenu appendTile(Matter matter) {
        list.add(matter);
        price = price.add(area.multiply(matter.price()));
        return this;
    }

    @Override
    public String getDetail() {
        StringBuilder detail = new StringBuilder("\r\n------------------------"
            + "装修清单："
        );
        return detail.toString();
    }
}
